import React from 'react';
import ProjectTree from './projectTree';
import ModelTree from './modelTree';

interface TreeContentPropsType {
  type: 'project' | 'model';
  isBlank: boolean;
  loading: boolean;
  projectTree: any;
  projectSelectKey: Array<string | number>;
  setProjectSelectKey: React.Dispatch<React.SetStateAction<(string | number)[]>>;
  projectCheckedKey: Array<string | number>;
  setProjectCheckedKey: React.Dispatch<React.SetStateAction<(string | number)[]>>;
}

const TreeContent = ({
  type,
  isBlank,
  projectTree,
  projectSelectKey,
  setProjectSelectKey,
  projectCheckedKey,
  setProjectCheckedKey,
  loading,
}: TreeContentPropsType) => {
  return (
    <React.Fragment>
      {/* 项目树 */}
      {type === 'project' ? (
        <ProjectTree
          loading={loading}
          isBlank={isBlank}
          projectTree={projectTree}
          projectSelectKey={projectSelectKey}
          setProjectSelectKey={setProjectSelectKey}
          projectCheckedKey={projectCheckedKey}
          setProjectCheckedKey={setProjectCheckedKey}
        />
      ) : null}

      {/* 模型树 */}
      {type === 'model' ? <ModelTree /> : null}
    </React.Fragment>
  );
};

export default TreeContent;
